package net.zjitc.utils;

import java.util.List;

/**
 * 2 * @Author: 洪瑶
 * 3 * @Date: 2018/11/1 8:25
 * 4
 */
public class PageBean<E> {
    /**
     * 客户端设置
     */
    private int page;       //当前页
    private int pageSize;       //当前页显示条数
    /**
     * 数据库中查询
     */
    private int count;      //数条数
    private List<E> pageList;       //页面显示的数据集合
    /**
     * 计算
     */
    private int pageCount;         //数页数


    public PageBean() {
    }

    public PageBean(int page, int pageSize, int count, List<E> pageList, int pageCount) {
        this.page = page;
        this.pageSize = pageSize;
        this.count = count;
        this.pageList = pageList;
        this.pageCount = pageCount;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public List<E> getPageList() {
        return pageList;
    }

    public void setPageList(List<E> pageList) {
        this.pageList = pageList;
    }

    public int getPageCount() {
        //计算
        pageCount = count / pageSize;
        return (count % pageSize)==0?pageCount:pageCount + 1;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }
}
